home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 89 / 089.d81 / snake source (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1991-01-01  |  8.0 KB  |  257 lines

  1. 100 rem snake v1.0 *  completed 9/90 * edited 9/6/91 by david caruso ii
  2. 110 poke53265,11:dv=peek(186):ifdv<8thendv=8
  3. 120 a=2:f4=3
  4. 130 poke53272,24:gosub1020
  5. 140 poke54272,0:v=54276:t=54273:poke54296,15:a=rnd(ti)
  6. 150 c=1:sc=0:f=0:p=0:o=0:poke53280,14:poke53281,0:c5=0:mo=0:ys=0:hx=0:lh=0:sp=bs
  7. 160 bo=0:bn=int(rnd(1)*200)+400
  8. 170 poke53265,11:gosub1780:poke53265,27
  9. 180 goto1070
  10. 190 gosub200:goto350
  11. 200 poke53280,14
  12. 210 poke53265,11:print"[154][147]   \snake\    score          [211]   [255]      [146]";:gosub1270
  13. 220 a=f:gosub1010:ifa=0thenb$=" "
  14. 230 print"";b$;"[146]";:pokev,17:di=0
  15. 240 forg=1to23:print" [146]                                       [146]";:poket,g*2
  16. 250 next:pokev,16
  17. 260 print"                                       [146]":poke2023,160:poke53265,27
  18. 270 hb=int(rnd(1)*3)+5
  19. 280 cs=7:return
  20. 290 ifk=-1ork=1thena=67:goto310
  21. 300 a=66
  22. 310 sc=sc+1:e=e+1:ife>uthengosub1530
  23. 320 return
  24. 330 gosub2220:sh=3:ly=int(l/40):lx=l-(ly*40):sp=sp-6:poke1054,160:poke1058,160
  25. 340 mf=f:mp=o:f=0:o=0:poke1058,160:goto450
  26. 350 a=int(rnd(1)*20)+11:g=int(rnd(1)*9)+8:l=(g*40)+a
  27. 360 a=int(rnd(1)*4)+1:k=1:ifa=2thenk=-1
  28. 370 ifa=3thenk=40
  29. 380 ifa=4thenk=-40
  30. 390 gosub890
  31. 400 ifsh=0thensc=sc+1:ex=ex+1:poke1024+l,87:poke55296+l,5:e=e+1:ife>uthengosub1530
  32. 410 ifdi=1thengosub1680
  33. 420 ifmo=1thengosub2300:ifc5=1then1370
  34. 430 bo=bo+1:ifbo>bnthengosub1550
  35. 440 iflh>1thenlh=lh-1:iflh=1then330
  36. 450 iflh=1thengosub290:poke55296+l,c:poke1024+l,a:gosub2150
  37. 460 ifp>0thenpokev,17:poket,p:forg=1to1:next:pokev,16
  38. 470 a=sc:gosub1010:print"[154]";b$:goto490
  39. 480 pokev,17:poket,47:forg=1to1:next:pokev,16:return
  40. 490 forg=1tosp:next:geta$:ifa$=""then610
  41. 500 if(a$="k"ora$="")andk<>40andk<>-40thenk=40:gosub480:jd=1:goto620
  42. 510 if(a$="i"ora$="[145]")andk<>-40andk<>40thenk=-40:gosub480:jd=1:goto620
  43. 520 if(a$="l"ora$="")andk<>1andk<>-1thenk=1:gosub480:jd=1:goto620
  44. 530 ifa$="s"thengosub1510
  45. 540 if(a$="j"ora$="[157]")andk<>-1andk<>1thenk=-1:gosub480:jd=1:goto620
  46. 550 ifcs=7anda$=" "then490
  47. 560 ifa$=" "andf>0thenpoke53265,11:gosub2480:mo=0:gosub2250:gosub200:goto620
  48. 570 if(a$="u"ora$=chr$(13))ando>0ora$="p"ando>0thenp=40:o=o-1:gosub1270:goto620
  49. 580 ifa$="-"thensp=sp+2:bs=bs+2:goto620
  50. 590 ifa$=chr$(3)thengosub1350
  51. 600 ifa$="+"thengosub720
  52. 610 cs=0:jy=peek(56320)or128:ifjy<>255then2080
  53. 620 gosub830
  54. 630 h=peek(k+l+1024):ifh<>32then750
  55. 640 ifp=0then660
  56. 650 p=p-1:c=int(p/3)+2
  57. 660 poke55296+l,c:poke1024+l,de:ifp=0thenc=1:nh=0
  58. 670 ifsh=7then1370
  59. 680 k2=k:l=l+k:fs=fs+1:iffs=30thenfs=0:gosub920
  60. 690 ifpeek(k+l+1024)=87thensp=sp+6:gf=1
  61. 700 w=w+1:ifw>hbthen1310
  62. 710 goto400
  63. 720 sp=sp-2:ifsp<0thensp=0
  64. 730 bs=bs-2:ifbs<0thenbs=0
  65. 740 return
  66. 750 ifh=83thenpoke53280,1:sc=sc+25:goto960
  67. 760 ifh=90andp=0andlh<>1then1650
  68. 770 ifh>128andh<192then910
  69. 780 ifh=94thenpoke53280,1:sc=sc+25:goto1240
  70. 790 ifh=87thensh=0:sp=sp+6:lh=0:gosub2230:goto660
  71. 800 ifp>0then650
  72. 810 ifh=90andlh=1then660
  73. 820 sh=7:goto660
  74. 830 ifjd=3thenreturn
  75. 840 ifjd=2then890
  76. 850 jd=2:ifk=1andk2=40ork=-40andk2=-1thende=109:return
  77. 860 ifk=40andk2=-1ork=1andk2=-40thende=112:return
  78. 870 ifk=-1andk2=40ork=-40andk2=1thende=125:return
  79. 880 de=110:return
  80. 890 jd=3:ifk=-40ork=40thende=66:return
  81. 900 de=67:return
  82. 910 sh=7:goto660
  83. 920 forg=1to2:pokev,17:poket,20:forh=1to10:next:pokev,16:forh=1to35:next:next
  84. 930 a=int(rnd(1)*10)+1:ifa>5then1160
  85. 940 a=int(rnd(1)*917)+42:ifpeek(1024+a)=160then920
  86. 950 poke55296+a,10:poke1024+a,83:return
  87. 960 pokev,33:poket,10:forg=1to15:next:pokev,32
  88. 970 iff=1then990
  89. 980 f=f+1:a=f:gosub1010:print"";b$
  90. 990 poke53280,14:iflh=1thena$=" ":goto560
  91. 1000 goto660
  92. 1010 b$=str$(a):b$=right$(b$,len(b$)-1):return
  93. 1020 f4=5:a=rnd(ti):close8:open15,dv,15:open8,dv,8,"snake file,s,r"
  94. 1025 input#8,hs,bs,na$:input#15,a$:close8:f4=0
  95. 1030 forg=54272to54296:pokeg,0:next:poke54277,30:poke54278,0:so=1
  96. 1040 iflen(na$)=0thenna$="john galt"
  97. 1050 ifbs<1thenbs=70
  98. 1060 return
  99. 1070 geta$:ifa$=""then1070
  100. 1080 ifa$="q"then1110
  101. 1090 ifa$="[200]"then1180
  102. 1100 goto190
  103. 1110 printc$;"[145][145][145][145][145][145][145][157][157][157][157][157][157][157][157][157][157][157][157] sure? (y/n)"
  104. 1120 geta$:ifa$<>"y"anda$<>"n"then1120
  105. 1130 ifa$="y"then2570
  106. 1140 printc$;"[145][145][145][145][145][145][145][157][157][157][157][157][157][157][157][157][157][157][157]            ";
  107. 1150 gosub2050:goto1070
  108. 1160 a=int(rnd(1)*917)+42:ifpeek(1024+a)=160then1160
  109. 1170 poke55296+a,7:poke1024+a,94:return
  110. 1180 rem clear high score
  111. 1190 printc$;"[158]            \\\ clearing \\\        ";
  112. 1200 close15:open15,dv,15:print#15,"s0:snake file":close15
  113. 1210 bs=70:hs=100:na$="john galt"
  114. 1220 close8:open8,dv,8,"snake file,s,w":print#8,hs:print#8,bs:print#8,na$:close8
  115. 1230 gosub2000:goto1070
  116. 1240 pokev,33:poket,30:forg=1to15:next:pokev,32
  117. 1250 ifo=3then1290
  118. 1260 o=o+1:gosub1270:goto1290
  119. 1270 a=o:gosub1010:ifa=0thenb$=" "
  120. 1280 print"";b$:return
  121. 1290 poke53280,14:iflh=1thenpoke198,1:poke631,47
  122. 1300 goto660
  123. 1310 a=int(rnd(1)*917)+42:ifpeek(1024+a)<>32andck<5thenck=ck+1:goto1310
  124. 1320 forg=1to4:ifa=(k*g)+lthenpoke64,206:goto1310
  125. 1330 next:ck=0:pokev,17:poket,11:forg=1to10:next:pokev,16
  126. 1340 poke1024+a,214:poke55296+a,15:w=0:goto400
  127. 1350 geta$:ifa$=""then1350
  128. 1360 return
  129. 1370 poke53280,2:pokev,129:forg=100to20step-1:poket,g:next:forg=1to10:next:sh=0
  130. 1380 a=hx:gosub1010:a$="bonus \"+b$:sc=sc+hx
  131. 1390 a=sc:gosub1010:a$=a$+"\  final score \"+b$+"\"
  132. 1400 b$="                                        ":print"[154]";b$
  133. 1410 a$=left$(b$,20-int(len(a$)/2))+a$:print"";a$
  134. 1420 pokev,128:poket,0:poke54272,0:poke198,0:ifsc>hsthenhs=sc:goto1460
  135. 1430 print"[154]             (press a key)              [146]"
  136. 1440 geta$:ifa$=""then1440
  137. 1450 goto150
  138. 1460 a$="?":print"  high score!   your name:            [157][157][157][157][157][157][157][157][157][157][157]";
  139. 1470 gosub1700:na$=m$
  140. 1480 close15:open15,dv,15:print#15,"s0:snake file":close15
  141. 1490 close8:open8,dv,8,"snake file,s,w":print#8,hs:print#8,bs:print#8,na$:close8
  142. 1500 goto1430
  143. 1510 ifso=1thenpoke54296,0:so=0:return
  144. 1520 so=1:poke54296,15:return
  145. 1530 hb=hb-1:e=0:u=int(rnd(1)*30)+90:ifhb<2thenhb=2
  146. 1540 return
  147. 1550 bn=int(rnd(1)*200)+400:bo=0
  148. 1560 a=int(rnd(1)*3)+1:ifa<>2thenreturn
  149. 1570 a=int(rnd(1)*1000)+1:ifpeek(1024+a)=32then1600
  150. 1580 cr=cr+1:ifcr=6thenreturn
  151. 1590 goto1570
  152. 1600 cr=0:sl=a:poke1024+a,90:poke55296+a,3:di=1
  153. 1610 pokev,17:forg=80to190:poket,g:next:pokev,16:return
  154. 1620 iff4=5thenhs=100:na$="john galt":sp=70:close8:f4=0:gosub1030:goto140
  155. 1630 iff4=3thengosub1020:goto140
  156. 1640 poke53280,0:poke53265,11:forg=1to2000:next:poke186,dv:run
  157. 1650 a=53280:pokea,11:sc=sc+500:pokev,17:forg=20to90:poket,g:next:pokea,12:di=0
  158. 1660 forg=90to60step-1:poket,g:next:pokea,15
  159. 1670 forg=60to130:poket,g:next:pokev,16:pokea,14:goto660
  160. 1680 j=j+1:ifj=16thenj=1
  161. 1690 poke55296+sl,j:return
  162. 1700 m$="":m=0
  163. 1710 geta$:ifa$=""then1710
  164. 1720 a=asc(a$):ifa=32ora=46then1760
  165. 1730 ifa$=chr$(13)andm>0thenreturn
  166. 1740 ifa=20andm>0then1770
  167. 1750 ifa<65ora>90orm=11then1710
  168. 1760 m=m+1:m$=m$+a$:print"";a$;:goto1710
  169. 1770 m=m-1:m$=left$(m$,m):print"[157] [157]";:goto1710
  170. 1780 ws=1:poke53280,2:print"[158][147]               s n a k e                ";
  171. 1790 print"                                        ";
  172. 1800 print"           by david caruso ii           ";
  173. 1810 print"                                        ";
  174. 1820 print"[146][155]guide your snake between walls and"
  175. 1830 print"rocks. collect special items along"
  176. 1840 print"the way. use fire ([150][211][155]) to clear area."
  177. 1850 print"bonus is awarded for things burned.
  178. 1860 [153]"use power (sys(NULL)list) to pound through all"
  179. 1870 [153]"obstacles and collect items. do not"
  180. 1880 [153]"lose your mind while playing.":[153]"contfrefrefrefrefrefrefrefre"
  181. 1890 [153]" points wait  def(NULL)cont..25  sys(NULL)cont..25  print(NULL)cont..500  openspc(cont..?":[153]"pospospospospospospospos"
  182. 1900 [153]"              keys to use               wait";
  183. 1910 [153]"pospospospospos        pospospospospospospospospospospos"
  184. 1920 [153]" [i] wait listnorth   [space]   wait liststart fire"
  185. 1930 [153]" [k] wait listsouth   [u] [p]   wait listuse power"
  186. 1940 [153]" [j] wait listwest    [stop]    wait listpause"
  187. 1950 [153]" [l] wait listeast    [+] [-]   wait listalter speed"
  188. 1960 [153]" [q] wait listquit    [shift-h] wait listclear high"
  189. 1970 [153]"usrusrusrusrusr        usrusrusrusrusrusrusrusrusrusrusr"
  190. 1980 c$[178]""
  191. 1990 [153]c$;"           current high score           ";
  192. 2000 a$[178]"                                       ":[151]198,0
  193. 2010 [153]c$;"sys";a$;:[151]2023,160
  194. 2020 a[178]hs:[141]1010:b$[178]b$[170]" by "[170]na$
  195. 2030 b$[178][200](a$,20[171][181]([195](b$)[173]2))[170]b$
  196. 2040 [153]c$;"sys";b$;
  197. 2050 [153]""
  198. 2060 [142]
  199. 2070 [151]v,17:[151]t,47:[129]g[178]1[164]1:[130]:[151]v,16:[142]
  200. 2080 [139]jy[178]254[175]k[179][177]40[175]k[179][177][171]40[167]k[178][171]40:[141]2070:jd[178]1:[137]620
  201. 2090 [139]jy[177]244[175]jy[179]248[175]k[179][177][171]1[175]k[179][177]1[167]k[178]1:[141]2070:jd[178]1:[137]620
  202. 2100 [139]jy[178]253[175]k[179][177][171]40[175]k[179][177]40[167]k[178]40:[141]2070:jd[178]1:[137]620
  203. 2110 [139]jy[177]248[175]jy[179]252[175]k[179][177]1[175]k[179][177][171]1[167]k[178][171]1:[141]2070:jd[178]1:[137]620
  204. 2120 [139]jy[178]239[167]a$[178]" ":[137]560
  205. 2130 [139]jy[179]239[167]a$[178]"/":[137]570
  206. 2140 [137]620
  207. 2150 [139]gf[178]1[167]sh[178]0:gf[178]0:lh[178]0:[141]2230:[142]
  208. 2160 [151]1024[170]lx[170](40[172]ly),32
  209. 2170 lx[178]lx[170]dx:[139][194](1024[170]lx[170](40[172]ly))[179][177]32[167]dx[178][171]dx:[141]2220:lx[178]lx[170]2[172]dx
  210. 2180 ly[178]ly[170]dy:[139][194](1024[170]lx[170](40[172]ly))[179][177]32[167]dy[178][171]dy:[141]2220:ly[178]ly[170]2[172]dy
  211. 2190 [139][194](1024[170]lx[170](40[172]ly))[179][177]32[167]2170
  212. 2200 [151]1024[170]lx[170](40[172]ly),87:[151]55296[170]lx[170](40[172]ly),5
  213. 2210 [142]
  214. 2220 [151]v,17:[151]t,29:[129]g[178]1[164]1:[130]:[151]v,16:[142]
  215. 2230 f[178]mf:o[178]mp:[141]1270:[139]f[178]1[167][151]1054,177
  216. 2240 [142]
  217. 2250 a1[178][181]([187](1)[172]100)[170]1:[139]a1[177]23[167][142]
  218. 2260 uh[178]0:mo[178]1:f[178]0:r2[178][181]([187](1)[172]21)[170]2:c2[178][181]([187](1)[172]38)[170]1
  219. 2270 g[178][181](l[173]40):a[178]l[171](g[172]40):[139][182](r2[171]g)[179]8[176][182](c2[171]a)[179]8[167]2260
  220. 2280 ws[178]ws[170].3:[139]ws[177]3[167]ws[178]3
  221. 2290 xd[178]ws:[142]
  222. 2300 [139]ys[178][181](xd)[167]ys[178]0:[142]
  223. 2310 ys[178]ys[170]1
  224. 2320 [139]lh[178]1[167]rs[178]ly:cs[178]lx:[137]2340
  225. 2330 rs[178][181](l[173]40):cs[178]l[171](rs[172]40)
  226. 2340 [151]1024[170](r2[172]40)[170]c2,32
  227. 2350 [139]r2[177]rs[167]r2[178]r2[171]1:[137]2370
  228. 2360 [139]r2[179]rs[167]r2[178]r2[170]1
  229. 2370 [139]c2[177]cs[167]c2[178]c2[171]1:[137]2390
  230. 2380 [139]c2[179]cs[167]c2[178]c2[170]1
  231. 2390 [151]v,33:[151]t,12:[129]g[178]1[164]5:[130]:[151]v,32
  232. 2400 a[178](r2[172]40)[170]c2:[139][194](1024[170]a)[179][177]32[167][151]1024[170]a,230:[141]2450:[137]2420
  233. 2410 [151]1024[170]a,102
  234. 2420 [151]55296[170]a,3
  235. 2430 [139]c2[178]cs[175]r2[178]rs[167]c5[178]1
  236. 2440 [142]
  237. 2450 uh[178]uh[170]1:[139]uh[178]40[167]xd[178]xd[170]1:uh[178]0
  238. 2460 [139]xd[177]4[167]xd[178]4
  239. 2470 [142]
  240. 2480 f[178]f[171]1:[139]mo[178]1[167]sc[178]sc[170](([181](ws)[171]1)[172]100)
  241. 2490 ex[178][181](ex[173]2):sc[178]sc[170]ex:[139]ex[177]hx[167]hx[178]ex
  242. 2500 [139]lh[177]0[167]2560
  243. 2510 a[178][181]([187](1)[172]100)[170]1:[139]a[177]22[167]2560
  244. 2520 lh[178][181]([187](1)[172]400)[170]50:a[178][181]([187](1)[172]4)[170]1:[139]a[178]1[167]dy[178][171]1:dx[178][171]1
  245. 2530 [139]a[178]2[167]dy[178][171]1:dx[178]1
  246. 2540 [139]a[178]3[167]dy[178]1:dx[178]1
  247. 2550 [139]a[178]4[167]dy[178]1:dx[178][171]1
  248. 2560 ex[178]0:[142]
  249. 2570 [143] ***** place routine here ****
  250. 2580 [143]
  251. 2590 [153]"loadsys
  252. 60000 close15:a$="hello connect":open15,8,15,"r0:"+a$+"="+a$:input#15,er:close15
  253. 60010 if er<>63 then print"[147]":end
  254. 60011 q$=chr$(34):poke646,peek(53281):print"[147]"
  255. 60020 print"load"q$a$q$",8"
  256. 60030 print"run":poke631,13:poke632,13:poke198,2:end
  257.